set :application, "yipingba"
set :repository,  "http://hidoudou.googlecode.com/svn/trunk/development/yipingba"

set :scm, :subversion
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`

set :user, "root"
role :web, "118.126.2.138"                          # Your HTTP server, Apache/etc
role :app, "118.126.2.138"                          # This may be the same as your `Web` server
role :db,  "118.126.2.138", :primary => true # This is where Rails migrations will run

set :use_sudo, true
if ENV['where'] == 'releases'
	set :deploy_to, "/home/www/yipingba/yipingba_production"
else
	set :deploy_to, "/home/www/yipingba/yipingba_staging"
end

namespace :custom do
  desc "symlink brands logo path"
  task :symlink_brand_logo, :roles => [:web, :app] do
    run <<-CMD
      ln -nfs #{shared_path}/images/brands #{current_path}/public/brands
    CMD
  end
end

namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
    run <<-CMD
      ln -nfs  #{shared_path}/config/database.yml #{current_path}/config/database.yml;
    CMD
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
    
    run "ln -nfs  #{shared_path}/config/sphinx.yml #{current_path}/config/sphinx.yml"
    run "ln -nfs  #{shared_path}/config/development.sphinx.conf #{current_path}/config/development.sphinx.conf"
  end
	
  task :after_update_code, :roles => :app do
    run "rm -rf #{release_path}/public/.htaccess"
  end
end

#after "deploy:symlink", "custom:symlink_brand_logo"
